package com.yilu.driver.mvp.presenter;


import com.is.common.retrofitrxcache.RxCacheResult;
import com.is.common.rx.RxSubscriber;
import com.is.common.utils.LogUtils;
import com.yilu.driver.entity.Weather;
import com.yilu.driver.mvp.contract.ProjectListContract;

public class ProjectListPresenter extends ProjectListContract.Presenter {

    @Override
    public void getWeatherByCity(String key) {

        mRxManager.add(mModel.getWeather(key)
                .subscribe(new RxSubscriber<RxCacheResult<Weather>>(
                        mContext, "加载中", true) {
                    @Override
                    protected void _onNext(RxCacheResult<Weather> weatherRxCacheResult) {
                        mView.returnWeather(weatherRxCacheResult.getResultModel());
                    }

                    @Override
                    protected void _onError(String message) {
                        LogUtils.logd(message);
                    }
                }));
    }
}
